package com.his.dictitem.controller;

import com.his.config.annotation.CurrentUser;
import com.his.dictitem.entity.DictItemMedicine;
import com.his.dictitem.service.DictItemMedicineService;
import com.his.dictitem.vo.DictItemMedicineVo;
import com.his.login.entity.DictEmployee;
import com.xiao.common.controller.ResultBaseController;
import com.xiao.common.util.BeanUtil;
import com.xiao.common.util.ResultUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;


/**
 * 项目属性控制类
 * @Author tansonglin
 * @Date 2020/3/14
 */
@RestController
@RequestMapping(value="/api/dict_item_medicine")

public class DictItemMedicineController extends ResultBaseController {

    private  final Logger logger = (Logger) LoggerFactory.getLogger(this.getClass());

    @Autowired
    private DictItemMedicineService dictItemMedicineService;

    /**
     *智能过滤更新
     */
    @PostMapping(value="/update_by_selective.do")
    public ResultUtil updateItemMedicine(@CurrentUser DictEmployee dictEmployee,@RequestBody DictItemMedicineVo dictItemMedicineVo){
        try {
            dictItemMedicineService.updateItemMedicine(dictEmployee,dictItemMedicineVo);
            return this.success("成功",null);
        }catch (Exception e){
            e.printStackTrace();
            logger.error(e.getMessage());
            return this.fail(e.getMessage(),null);
        }
    }
}
